home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 1
/
BUGCD1996_0708.ISO
/
pc
/
util
/
minilin
/
minilin.exe
/
DEV
/
MAKEDEV.{66
< prev
next >
Wrap
Text File
|
1994-02-19
|
9KB
|
343 lines
#! /bin/sh -
# $Id: MAKEDEV,v 1.3 1994/01/04 10:27:24 alfie Exp alfie $
#
# This is my attempt at a MAKEDEV script. IMHO it cleans up many areas.
# It can be used to determine the necessary info for a device without
# actually creating it using the '-n' flag.
#
# It is based (heavily) on Jim Winstead's version and my main source of
# information has been Rick Miller's Linux device list.
#
# It makes less individual devices and tends to make classes of devices
# (eg "MAKEDEV hda" will create "hda" and the 8 partitions; "MAKEDEV ptyp"
# will create the ptyp[0-f] master and ttyp[0-f] slave devices).
#
# The group used for the devices are changeable at the head of the script,
# so you can edit these to match the groups on your system, or your whims.
#
# If you are aware of any glaring omissions or errors, please let me know.
#
# Thanks to Ian Jackson for help and encouragement.
#
# Nick Holloway <alfie@dcs.warwick.ac.uk>
# Last changed: 4th January 1994
#
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
# Device 'make' file. Valid arguments:
#
# generic create a generic subset of devices
# local configuration specific devices (runs MAKEDEV.local)
# std standard devices
# Virtual Terminals:
# console (also known as tty0)
# tty{0..63} virtual consoles
# Serial devices:
# ttyS{0..63} serial ports and corresponding dialout device
# Pseudo Terminals:
# pty[p-s] banks of of master and slave pseudo terminals
# Parallel ports:
# par[0-3] parallel ports
# lp[0-3] "" ""
# Bus Mice:
# busmice various bus mice
# Joystick:
# js joystick
# Disks:
# fd[0-4] floppy disks
# hd[a-d] AT hard disks (1st controller)
# hd1[a-d] 2nd AT controller hard disks
# xd[a-d] XT hard disks
# sd[a-i] SCSI hard disks
# loop Loopback disk devices
# Tapes:
# st[0-1] SCSI tapes
# qic QIC-80 tapes
# ftape floppy driver tapes (QIC-117)
# CD:
# scd[0-1] SCSI CD players
# sonycd Sony CDU-31A CD player
# mcd Mitsumi CD player
# cdu535 Sony CDU-535 CD player
# lmscd LMS/Philips CD player (needs new major number)
# sbpcd Sound Blaster CD player
# Networking:
# net various protocol control devices (?)
# we[0-3],wd[0-3],ec[0-3],ne[0-3]
# various net interfaces (?)
# Audio:
# audio various audio devices
# pcaudio audio devices used by pcsndrv
# Misc:
# sg generic SCSI devices
# fd file names for file descriptors
#
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
# Define what group a collection of devices will be created with -- you will
# probably need to edit the right hand side to to match your groups.
system=sys
kmem=kmem
tty=tty
dialout=uucp
mouse=sys
printer=daemon
floppy=floppy
disk=disk
cdrom=disk
tape=disk
net=sys
audio=sys
#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#---#
makedev () { # usage: makedev name [bcu] major minor owner:group mode
rm -f $1
mknod $1 $2 $3 $4 &&
chown $5 $1 &&
chmod $6 $1
}
symlink () { # usage: symlink name target
rm -f $1
ln -s $2 $1
}
debug=
if [ _"-n" = _"$1" ]
then
shift
debug=-n
makedev () {
echo "$1 = $2 $3 $4 $5 $6"
}
symlink () {
echo "$1 -> $2"
}
fi
for arg
do
case $arg in
generic)
sh $0 $debug std
sh $0 $debug fd0 fd1
sh $0 $debug hda hdb
sh $0 $debug xda xdb
sh $0 $debug sda sdb
sh $0 $debug ptyp ptyq ptyr ptys
sh $0 $debug console tty1 tty2 tty3 tty4 tty5 tty6 tty7 tty8
sh $0 $debug ttyS0 ttyS1 ttyS2 ttyS3
sh $0 $debug busmice
sh $0 $debug lp0 lp1 lp2
sh $0 $debug par0 par1 par2
;;
local)
sh $0.local $debug
;;
std)
makedev mem c 1 1 root:$kmem 660
makedev kmem c 1 2 root:$kmem 660
makedev null c 1 3 root:$system 666
makedev port c 1 4 root:$kmem 660
makedev zero c 1 5 root:$system 666
# makedev core c 1 6 root:$kmem 660
makedev full c 1 7 root:$system 666
makedev ram b 1 1 root:$disk 660
makedev tty c 5 0 root:$tty 666
;;
console)
makedev console c 4 0 root:$tty 622
;;
tty[0-9]|tty[1-5][0-9]|tty[6][0-3])
line=`expr $arg : "tty\(.*\)"`
makedev tty$line c 4 $line root:$tty 622
;;
ttyS[0-9]|ttyS[1-5][0-9]|ttyS[6][0-3])
line=`expr $arg : "ttyS\(.*\)"`
minor=`expr 64 + $line`
makedev ttyS$line c 4 $minor root:$tty 666
makedev cua$line c 5 $minor root:$dialout 660
;;
pty[p-s])
# Currently limited to 64 master/slave pairs.
bank=`expr $arg : "pty\(.\)"`
base=`expr \( pqrs : ".*$bank" - 1 \) \* 16`
for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do
j=`expr 0123456789abcdef : ".*$i" - 1`
makedev pty$bank$i c 4 `expr 128 + $base + $j` root:$tty 666
makedev tty$bank$i c 4 `expr 192 + $base + $j` root:$tty 666
done
;;
par[0-2])
port=`expr $arg : "par\(.\)"`
makedev $arg c 6 $port root:$printer 660
;;
lp[0-2])
port=`expr $arg : "lp\(.\)"`
makedev $arg c 6 $port root:$printer 660
;;
busmice)
makedev logibm c 10 0 root:$mouse 666
makedev psaux c 10 1 root:$mouse 666
makedev inportbm c 10 2 root:$mouse 666
makedev atibm c 10 3 root:$mouse 666
;;
js)
makedev js0 c 15 0 root:$mouse 666
makedev js1 c 15 1 root:$mouse 666
;;
fd[0-4])
unit=`expr $arg : "fd\(.\)"`
makedev fd$unit b 2 $unit root:$floppy 660
makedev fd${unit}d360 b 2 `expr $unit + 4` root:$floppy 660
makedev fd${unit}h1200 b 2 `expr $unit + 8` root:$floppy 660
makedev fd${unit}D360 b 2 `expr $unit + 12` root:$floppy 660
makedev fd${unit}H360 b 2 `expr $unit + 12` root:$floppy 660
makedev fd${unit}D720 b 2 `expr $unit + 16` root:$floppy 660
makedev fd${unit}H720 b 2 `expr $unit + 16` root:$floppy 660
makedev fd${unit}h360 b 2 `expr $unit + 20` root:$floppy 660
makedev fd${unit}h720 b 2 `expr $unit + 24` root:$floppy 660
makedev fd${unit}H1440 b 2 `expr $unit + 28` root:$floppy 660
;;
hd[a-d])
unit=`expr $arg : "hd\(.\)"`
base=`expr \( abcd : ".*$unit" - 1 \) \* 64`
makedev hd$unit b 3 $base root:$disk 660
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
do
makedev hd$unit$part b 3 `expr $base + $part` root:$disk 660
done
;;
hd1[a-d])
unit=`expr $arg : "hd1\(.\)"`
base=`expr \( abcd : ".*$unit" - 1 \) \* 64`
makedev hd1$unit b 22 $base root:$disk 660
for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16
do
makedev hd1$unit$part b 22 `expr $base + $part` root:$disk 660
done
;;
xd[a-d])
unit=`expr $arg : "xd\(.\)"`
base=`expr \( abcd : ".*$unit" - 1 \) \* 64`
makedev xd$unit b 13 $base root:$disk 660
for part in 1 2 3 4 5 6 7 8 # 9 10 11 12 13 14 15 16
do
makedev xd$unit$part b 13 `expr $base + $part` root:$disk 660
done
;;
sd[a-h])
unit=`expr $arg : "sd\(.\)"`
base=`expr \( abcdefgh : ".*$unit" - 1 \) \* 16`
makedev sd$unit b 8 $base root:$disk 660
for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do
makedev sd$unit$part b 8 `expr $base + $part` root:$disk 660
done
;;
loop)
for part in 0 1 2 3 4 5 6 7
do
makedev loop$part b 12 $part root:$disk 660
done
;;
st[0-1])
unit=`expr $arg : "st\(.\)"`
makedev st$unit c 9 $unit root:$tape 660
makedev nst$unit c 9 `expr 128 + $unit` root:$tape 660
;;
qic)
makedev rmt8 c 12 6 root:$tape 660
makedev rmt16 c 12 8 root:$tape 660
makedev tape-d c 12 136 root:$tape 660
makedev tape-reset c 12 255 root:$tape 660
;;
ftape)
makedev ftape c 27 0 root:$tape 660
makedev nftape c 27 4 root:$tape 660
;;
scd[0-1])
unit=`expr $arg : "scd\(.\)"`
makedev scd$unit b 11 $unit root:$cdrom 660
;;
sonycd)
makedev $arg b 15 0 root:$cdrom 660
;;
mcd)
makedev $arg b 23 0 root:$cdrom 660
;;
cdu535)
makedev $arg b 24 0 root:$cdrom 660
;;
# lmscd)
# makedev $arg b 24 0 root:$cdrom 660
# ;;
sbpcd)
makedev $arg b 25 0 root:$cdrom 660
;;
net)
makedev socket c 16 0 root:$net 600
makedev arp c 16 1 root:$net 600
makedev unix c 17 0 root:$net 600
makedev inet c 18 0 root:$net 600
makedev ip c 18 1 root:$net 600
makedev icmp c 18 2 root:$net 600
makedev tcp c 18 3 root:$net 600
makedev udp c 18 4 root:$net 600
;;
we[0-3])
card=`expr $arg : "we\(.\)"`
makedev $arg c 19 $card root:$net 600
;;
wd[0-3])
card=`expr $arg : "wd\(.\)"`
makedev $arg c 20 $card root:$net 600
;;
ec[0-3])
card=`expr $arg : "ec\(.\)"`
makedev $arg c 20 `expr 8 + $card` root:$net 600
;;
ne[0-3])
card=`expr $arg : "ne\(.\)"`
makedev $arg c 20 `expr 16 + $card` root:$net 600
;;
audio)
makedev mixer c 14 0 root:$audio 666
makedev sequencer c 14 1 root:$audio 666
makedev midi c 14 2 root:$audio 666
makedev dsp c 14 3 root:$audio 666
makedev audio c 14 4 root:$audio 666
makedev sndstat c 14 6 root:$audio 666
# makedev dsp1 c 14 19 root:$audio 666
# makedev audio1 c 14 20 root:$audio 666
;;
pcaudio)
makedev pcmixer c 30 0 root:$audio 666
makedev pcsp c 30 3 root:$audio 666
makedev pcaudio c 30 4 root:$audio 666
;;
sg)
for unit in a b c d e f g h
do
minor=`expr abcdefgh : ".*$unit" - 1`
makedev $arg$unit c 21 $minor root:$system 660
done
;;
fd)
# not really devices, we use the /proc filesystem
symlink fd /proc/self/fd
symlink stdin fd/0
symlink stdout fd/1
symlink stderr fd/2
;;
*)
echo "don't know how to make device \"$arg\"" >&2
;;
esac
done
exit 0